
package pack0916;

// 练习2：求出100 - 1000之内的水仙花数。
public class DemoE {
    public static void main(String[] args) {
        int number = 100;
        do {
            // 判断这个数是否是水仙花数
            int gewei = number % 10;
            int shiwei = number / 10 % 10;
            int baiwei = number / 100;
            if ((gewei * gewei * gewei + shiwei * shiwei * shiwei + baiwei * baiwei * baiwei) == number) {
                System.out.println(number + "是水仙花数！");
            }
            number++;
        } while (number < 1000);
    }
}